//
//  GTretweed_statusCell.swift
//  swiftWEIbo
//
//  Created by mac－gt on 15/11/29.
//  Copyright © 2015年 mac－gt. All rights reserved.
//

import UIKit

class GTretweed_statusCell: GTStatusCell {
    private lazy var retweed_contentLable:UILabel={
        let lable=UILabel()
//        lable.textColor=UIColor.whiteColor()
        lable.numberOfLines=0;
         lable.preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width-16
        lable.font=UIFont.systemFontOfSize(12)
//        lable.sizeToFit()/
        return lable
    }()
    private lazy var bgButton:UIButton={
        let button=UIButton()
        button.backgroundColor=UIColor.lightGrayColor()
        return button
    }()
   override var status: GTStatus?{
        didSet{
            let text=(status?.retweeted_status?.text) ?? " "
            let name=status?.retweeted_status?.user?.screen_name ?? " "
            retweed_contentLable.text="@\(name):\(text)"
        }
    }
    override func setUp(){
        super.setUp()
        contentView.insertSubview(bgButton, atIndex: 0)

        contentView.addSubview(retweed_contentLable)
       
        bgButton.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: contentLabel, size: nil, offset: CGPoint(x: -8, y: 8))
        bgButton.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bottonView, size: nil)
        retweed_contentLable.ff_AlignInner(type: ff_AlignType.TopLeft, referView: bgButton, size: nil, offset: CGPoint(x: 8, y: 8))

        contentView.addConstraint(NSLayoutConstraint(item: retweed_contentLable, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: UIScreen.mainScreen().bounds.width-2*8))
        let con=pictureView.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: retweed_contentLable, size: CGSize(width: 0, height: 0), offset: CGPoint(x: 0, y: 8))
        pictureViewWidthCon=pictureView.ff_Constraint(con, attribute: NSLayoutAttribute.Width)
        pictureViewHeightCon=pictureView.ff_Constraint(con, attribute: NSLayoutAttribute.Height)
    
    }
}
